#include <head.h>

int main(int argc, char const *argv[])
{
    int sock = socket( AF_INET , SOCK_STREAM ,0);
    if (-1 == sock)
    {
        ERRLOG("创建套接字失败");
        exit(-1);
    }
    
    struct sockaddr_in server_addr;

    memset(&server_addr , 0 ,sizeof(server_addr));
    
    server_addr.sin_family = AF_INET;

    server_addr.sin_port = htons(7878);

    server_addr.sin_addr.s_addr = inet_addr("127.0.0.1");

    if (-1 == connect(sock , (struct sockaddr *)&server_addr ,sizeof(server_addr)))
    {
        ERRLOG("请求连接失败");
        close(sock);
        exit(-1);
    }
    
    char buf[1024];

    memset(buf , 0 ,sizeof(buf));

    recv(sock , buf , sizeof(buf), 0);

    printf("接收到的信息 %s \n",buf);

    close(sock);
    
    return 0;
}